<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>产品激活码管理</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}calendar/WdatePicker.js"></script>
	<style type="text/css">
		{literal}
			#type {
				width: 300px;
			}
		{/literal}
	</style>
</head>
<body>

<div class="container" style="width:96%">
	<form action="?do=default" method="get">
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td colspan="5">查询条件</td>
			</tr>
			<tr>
				<td class="form-inline">
					<div class="input-group">
						<div class="input-group-addon">是否激活</div>
						<select title="type" class="form-control" name="type" id="type">
							<option value="">全部</option>
							<option value="1" {if $s_data['type'] == 1}selected{/if}>是</option>
							<option value="0" {if $s_data['type'] === '0'}selected{/if}>否</option>
						</select>
					</div>
				</td>

				<td class="form-group col-xs-2" colspan="3" align="right">
					<input type="submit" value="搜索" class="btn btn-primary"/>
				</td>
			</tr>
		</table>
	</form>


	<table class="table table-bordered table-striped" align="center">
		<tr align="center">
			<td style="width: 10%">激活码</td>
			<td style="width: 10%">体脂秤蓝牙地</td>
			<td style="width: 10%">激活的用户id</td>
			<td style="width: 10%">更新时间</td>
			<td style="width: 10%">创建时间</td>
			<td style="width: 10%">操作</td>
		</tr>
		{if $list}
			{foreach $list as $k => $v}
				<tr align="center">
					<td>{$v.MCode}</td>
					<td id="b{$v.Id}">{$v.Bluetooth}</td>
					<td id="u{$v.Id}">{$v.UserId}</td>
					<td>{$v.UpdateTime}</td>
					<td>{$v.CreateTime}</td>
					<td><a onclick="restore({$v.Id})" class="btn btn-info">清除激活状态</a></td>
				</tr>
			{/foreach}
		{else}
			<td colspan="12">本页暂无相关数据</td>
		{/if}

	</table>
	<table class="table table-bordered table-striped" align="center">
		<tr>
			<td colspan="7" align="right">
				<div class="page_info">
					{if $page_info['count']}
						<div class="p_l">一共 {$page_info['count']} 条数据,共 {$page_info['page']} 页</div>{/if}
				</div>
				<div class="p_r">{$pagination}</div>
			</td>
		</tr>
	</table>
</div>
	{literal}
		<script type="text/javascript">
			function restore(id){
                top.swal({
                    title: "您确定要清除激活状态吗？",
                    type: "warning",
                    showCancelButton: true,
                    closeOnConfirm: false,
                    confirmButtonText: "是的，我要清除！",
                    cancelButtonText: "取消",
                    confirmButtonColor: "#ec6c62"
                }, function () {
                    $.ajax({
                        url: 'mcodeManage.php?do=Restore',
                        type: 'get',
                        data: {'id':id},
                        dataType: 'json',
                        success:function(rel){
                            if(rel.type == 1){
                                $("#b"+id).html('');
                                $("#u"+id).html(0);
                                setTimeout(function () {
                                    top.swal("清除成功！", "操作成功", "success")
                                }, 100);
                            }else {
                                top.swal("清除失败！", "操作失败", "error");
                            }
                        }
                    });
                });
            }
		</script>
	{/literal}
</body>
</html>